* Canelo and Baker "Intersecting Identities and Perceptions of Judicial Misconduct" Social Science Quarterly Replication Code 

* Stata/SE 18.0 use for Analyses 

use "Canelo Baker SSQ Replication Data.dta"

* Figure 1: Discrimainatory Misconduct and Perceptions of Fairness
	regress group_fair i.white_male
	coefplot, keep(*.white_male) xlab(-3(1)1) xline(0)
	
* Figure 2: Perceived Threat to Rights 
	regress threat_women i.Treatment
	estimates store threat_women

	regress threat_race i.Treatment
	estimates store threat_race
		
	regress threat_ethnic i.Treatment
	estimates store threat_ethnic
		
	* produce coef plot
		coefplot threat_women || threat_race || threat_ethnic, keep(*.Treatment) xline(0) byopts(col(3))
		
* Figure 3: Ability to Rule Fairly
	regress fair_women i.Treatment
	estimates store fair_women
		
	regress fair_race i.Treatment
	estimates store fair_race
		
	regress fair_eth i.Treatment
	estimates store fair_ethnic
	
	* produce coefplot 
		coefplot fair_women || fair_race || fair_ethnic, keep(*.Treatment) xline(0) xlab(-3(1)1) byopts(col(3))
		
* Figure 4: Access to Contraceptives Case
	regress bc_case i.Treatment 
	coefplot, keep(*.Treatment) xline(0) xlab(-2(1)1)
	
* Figure 5: Voter Registration Case
	destring vote_cont_case, replace
	regress vote_cont_case i.Treatment 
	coefplot, keep(*.Treatment) xline(0) xlab()	xlab(-2(1)1)
	
* Figure 6: Exclusionarly Housing Advertisement Cases
	destring h_ad_gender, replace
	destring h_ad_race, replace
	destring h_ad_eth, replace

	regress h_ad_gender i.Treatment 
	estimates store h_gend
	
	regress h_ad_race i.Treatment 
	estimates store h_race

	regress h_ad_eth i.Treatment 
	estimates store h_eth
		
	coefplot h_gend || h_race || h_eth, keep(*.Treatment) xline(0) xlab(-2(1)1) byopts(col(3)) 
	
* Figure 7: Affirmative Action Cases
	destring aa_gend, replace
	destring aarace, replace
	destring aaeth, replace
	
	regress aa_gend i.Treatment 
	estimates store aa_gend
	
	regress aarace i.Treatment
	estimates store aa_race
	
	regress aaeth i.Treatment  
	estimates store aa_eth
	
	coefplot aa_gend || aa_race || aa_eth, keep(*.Treatment) xline(0) xlab(-2(1)1) byopts(col(3))
	
* Figure 8: Judge Identity and Perceived Threat 
	regress threat_women i.judge_identity 
	estimates store threat_w

	regress threat_race i.judge_identity 
	estimates store threat_r
		
	regress threat_ethnic i.judge_identity 
	estimates store threat_e
	
	coefplot threat_w || threat_r || threat_e, keep(*.judge_identity) xline(0) xlab(-1(1)1) byopts(col(3))
	
	
** APPENDIX 
	* Section A: Respondent Demographics 
		tab PID 
		tab ideology
		tab gender 
		sum age, d
		tab race
		tab ethnicity
		tab income
		sum racial_resentment, d 
		sum ethnic_resentment, d 
		sum TotSexism, d 
	
	* Section B: Number of Respondents per Condition 
		tab Treatment 
		
	* Section C: Mean Values of Dependent Variables 
		
		tabstat threat_women, by(Treatment)
		tabstat threat_race, by(Treatment)
		tabstat threat_ethnic, by(Treatment)
		
		tabstat fair_women, by(Treatment)
		tabstat fair_race, by(Treatment)
		tabstat fair_eth, by(Treatment)
	
	* Section D: Manipulation Checks 
		tab gender_check 
		tab race_check
		tab both_check
		tab judge_ideo 
		
	* Section E: Inferring Judge Ideo 
		tabstat infer_judge_ideo, by(Treatment)
		
		* Figure E1
		
		graph bar infer_judge_ideo, over(scandal_type) ylab(0(1)6) title(White Male Judge) saving(i1), if judge_identity==0 
		* this graph does not match the pic 
		graph bar infer_judge_ideo, over(scandal_type) ylab(0(1)6) title(White Female Judge)  saving(i2), if judge_identity==1
		
		graph bar infer_judge_ideo, over(scandal_type) ylab(0(1)6) title(Black Male Judge) saving(i3), if judge_identity==2 
		graph bar infer_judge_ideo, over(scandal_type) ylab(0(1)6) title(Black Female Judge) saving(i4), if judge_identity==3 
		graph bar infer_judge_ideo, over(scandal_type) ylab(0(1)6) title(Hispanic Male Judge) saving(i5), if judge_identity==4 
		graph bar infer_judge_ideo, over(scandal_type) ylab(0(1)6) title(Hispanic Female Judge) saving(i6), if judge_identity==5 
		
gr combine i1.gph i2.gph i3.gph i4.gph i5.gph i6.gph, cols(2) 
		
	* Section H: Analyses by Judge Identity 
	* Table H1: Analyses by Judge Identity 
		* Model 1
		regress threat_women i.sexism_mis  
		* Model 2
		regress threat_race i.racism
		* Model 3
		regress threat_eth i.eth_disc
		
	* Section I: Regression Tables 
	* Table I1: Fairness by misconduct type
		regress group_fair i.white_male
		
	* Table I2: Perceived Threat to Rights
		regress threat_women i.Treatment
		regress threat_race i.Treatment
		regress threat_eth i.Treatment  
		
	* Table I3: Ability to Rule Fairly
		regress fair_women i.Treatment
		regress fair_race i.Treatment
		regress fair_eth i.Treatment
		
	* Table I4: Contraceptives and Voter Rights Cases
		regress bc_case i.Treatment
		regress vote_cont_case i.Treatment
		
	* Table I5: Housing and Affirmative Action Cases 
		regress  h_ad_gender i.Treatment
		regress  h_ad_race i.Treatment
		regress  h_ad_eth i.Treatment
		regress  aa_gend i.Treatment
		regress  aarace i.Treatment
		regress  aaeth i.Treatment
	
	* Table I6: Judge Identity and Perceived Threat 
		regress threat_women i.judge_identity
		regress threat_race i.judge_identity
		regress threat_ethnic i.judge_identity
	